package jnpf.client;

import jnpf.base.ActionResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(name = "jnpf-file")
public interface FileFeignClient {


    /**
     * 模板文件名
     *
     * @param fileName 模板文件名
     * @return 返回模板文件下载链接
     */
    @GetMapping(value = {"/Download/{type}/{fileName}"})
    ActionResult Download(@PathVariable("type") String type, @PathVariable("fileName") String fileName);

    /**
     * 根据模板文件获取永中编辑地址
     *
     * @param file 模板文件
     * @return 永中文件编辑地址
     */
    @PostMapping(value = {"/uploadEdit"}, consumes = {"multipart/form-data"})
    public ActionResult uploadEdit(@RequestPart("file") MultipartFile file);

    /**
     * 根据模板文件获取永中编辑地址
     *
     * @param file   模板文件
     * @param system 上传路径前缀
     * @return 永中文件编辑地址
     */
    @PostMapping(value = {"/uploadEdit/{system}"}, consumes = {"multipart/form-data"})
    public ActionResult uploadEdit(@RequestPart("file") MultipartFile file, @PathVariable("system") String system);

    @PostMapping(value = {"/Uploader/annex"}, consumes = {"multipart/form-data"})
    ActionResult uploader(@RequestHeader("Authorization") String token, @RequestPart("file") MultipartFile file);


    @GetMapping(value = {"/Download/{type}/{fileName}"})
    ActionResult download(@RequestHeader("Authorization") String token, @PathVariable("type") String type, @PathVariable("fileName") String fileName);

/*    @GetMapping(value = {"/Download/annex/{fileName}"})
    ActionResult download(@PathVariable("fileName") String fileName);*/


}
